package com.merlin.demo_wellshape.repository;

import com.merlin.demo_wellshape.pojo.DailyQuote;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface DailyQuoteRepository extends JpaRepository<DailyQuote, Long> {
    /**
     * 查询随机一条数据
     *
     * @return
     */
    @Query("SELECT q FROM DailyQuote q ORDER BY RAND() LIMIT 1")
    Optional<DailyQuote> findRandomQuote();
}
